package com.module.sysconfig.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.module.sysconfig.dao.ZdbMapper;
import com.module.sysconfig.entity.Zdb;
import com.module.sysconfig.service.ZdbService;
import com.support.cache.annotation.CacheEvict;
import com.support.cache.annotation.Cacheable;
import com.support.cache.annotation.KeyMode;

@Service
public class ZdbServiceImpl implements ZdbService{
	
	@Autowired
	private ZdbMapper zdbMapper;

	
	/**
	 * 新增字典表数据
	 */
	@CacheEvict(key="ALL_ZDB_RECORD")
	public void saveZdb(Zdb zdb) 
	{
		zdbMapper.saveZdb(zdb);
	}
	
	/**
	 * 修改字典表数据
	 */
	@CacheEvict(key="ALL_ZDB_RECORD")
	public void updateZdb(Zdb zdb) 
	{
		zdbMapper.updateZdb(zdb);
	}
	
	/**
	 * 刪除字典表数据
	 */
	@CacheEvict(key="ALL_ZDB_RECORD")
	public void deleteZdb(long id) 
	{
		zdbMapper.deleteZdb(id);
	}

	/**
	 * 查询字典表数据
	 * @param zdb
	 */
	@Cacheable(keyMode=KeyMode.KEY_ONLY, key="ALL_ZDB_RECORD")
	public List<Map<String, Object>> queryZdb()
	{
		List<Map<String, Object>> records = zdbMapper.queryZdb();
		return records;
	}

	public Zdb queryZdbById(long id) {
		
		return zdbMapper.queryZdbById(id);
	}
	
	public List<Map<String, Object>>queryZdbByZdmc(String zdmc)
	{
		List<Map<String, Object>> records = zdbMapper.queryZdbByZdmc(zdmc);
		return records;
	}
	

}
